//
//  DynamicJumpViewController.m
//  Item A House
//
//  Created by dlios on 15/5/26.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import "DynamicJumpViewController.h"
#import "HorseDyTableViewCell.h"
#import "DetailMainViewController.h"
@interface DynamicJumpViewController ()<UITableViewDataSource, UITableViewDelegate>

@end

@implementation DynamicJumpViewController
- (void)dealloc
{
    [_dyArray release];
    [super dealloc];
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.translucent = NO;
    [self createTabel];
}
- (void)createTabel
{
    UITableView *table = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64) style:UITableViewStylePlain];
    table.separatorStyle = UITableViewCellSeparatorStyleNone;
    [table registerClass:[HorseDyTableViewCell class] forCellReuseIdentifier:@"horse"];
    table.delegate = self;
    table.dataSource = self;
    [self.view addSubview:table];
    [table release];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [self.dyArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    HorseDyTableViewCell *horse = [tableView dequeueReusableCellWithIdentifier:@"horse"];
    horse.selectionStyle = UITableViewCellSelectionStyleNone;
    NSDictionary *horseDic = [self.dyArray objectAtIndex:indexPath.row];
    horse.label.text = [horseDic objectForKey:@"loupan_name"];
    horse.titleLabel.text = [horseDic objectForKey:@"title"];
    horse.inforLabel.text = [horseDic objectForKey:@"summary"];
    horse.data.text = [horseDic objectForKey:@"article_time_date"];
    return horse;
}
//行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 170;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    DetailMainViewController *det = [[DetailMainViewController alloc] init];
    det.hidesBottomBarWhenPushed = YES;
    det.detail = [self.dyArray objectAtIndex:indexPath.row];
    [self.navigationController pushViewController:det animated:YES];
    [det release];
    
}
@end
